"""
@Author : 合肥一元数智教育科技有限公司
@Date :  2025/11/1 8:46
@Description :  图片 音视频文件的操作
图片复制操作
desktop.png   -> cp_desktop.png
"""
opened_file = None
cp_file = None
try:
    opened_file = open('desktop.png', 'rb')
    # 读取图片资源
    b_pic = opened_file.read()

    # 目标文件
    cp_file = open('cp_desktop.png', 'wb')
    cp_file.write(b_pic)


except Exception as e:
    print(f'文件操作失败,{str(e)}')
finally:
    # 释放资源
    if opened_file:
        opened_file.close()
    if cp_file:
        cp_file.close()
